package leetcode;

public class Test551 {
    public static void main(String[] args) {
        Test551 test551 = new Test551();
        System.out.println(test551.checkRecord("PPALLP"));

    }
    public boolean checkRecord(String s) {
        int absent = 0, late = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'A') {
                absent++;
            }
            if (i > 0 && s.charAt(i) == 'L' && s.charAt(i - 1) == 'L') {
                late++;
            }
            else{
                late=0;
            }
        }
        if(absent<=2&&late<=3){
            return true;
        }
        return false;

    }


}
